﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using RSPJ.Struct;

namespace RSPJ.Windows
{
    public partial class TextPanel : Form
    {
        string info;
        public TextPanel(string info)
        {
            InitializeComponent();
            this.info = info;
        }

        private void btnExport_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "文本文档 (*.txt)|*.txt|" + "All files (*.*)|*.*";
            sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                rtb.SaveFile(sfd.FileName, RichTextBoxStreamType.PlainText);
                MessageBox.Show("成功！");
            }
        }

        private void TextPanel_Shown(object sender, EventArgs e)
        {
            rtb.Text = info;
        }
    }
}
